package com.burgeon.backend.SHOPBACKEND.controller;
/**
 * 开卡任务界面
 */

import com.burgeon.backend.SHOPBACKEND.entity.openCardTask.EMPListData;
import com.burgeon.backend.SHOPBACKEND.service.BackendOpenCardTaskService;
import com.burgeon.backend.stsutil.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;

@RequestMapping("backend/task")
@RestController
@CrossOrigin
public class BackendOpenCardTaskController extends BaseController {

    @Autowired
    private BackendOpenCardTaskService backendOpenCardTaskService;

    @RequestMapping("getData")
    public ResponseResult<HashMap> getData(String yearmonth, String account) {
        HashMap data = backendOpenCardTaskService.topData(yearmonth, account);
        return new ResponseResult<HashMap>(SUCCESS,data);
    }

    @RequestMapping("vipList")
    public ResponseResult<HashMap> vipList(Integer start, String account) {
        HashMap data = backendOpenCardTaskService.vipList(start, account);
        return new ResponseResult<HashMap>(SUCCESS,data);
    }

    @RequestMapping("vipListFind")
    public ResponseResult<HashMap> vipListFind(Integer start, String field, String value, String account) {
        HashMap data = backendOpenCardTaskService.vipListFind(start,field,value, account);
        return new ResponseResult<HashMap>(SUCCESS,data);
    }

    /**
     *
     * @param start
     * @param field A 店名 B销售区域 C品牌 D无条件
     * @param value
     * @param account
     * @return
     */
    @RequestMapping("storeList")
    public ResponseResult<HashMap> storeList(Integer start, String field, String value, String time, String account) {
        HashMap data = backendOpenCardTaskService.storeList(field,value,start ,time,account);
        return new ResponseResult<HashMap>(SUCCESS,data);
    }

    @RequestMapping("empList")
    public ResponseResult<ArrayList<EMPListData>> empList(String id, String account) {
        ArrayList<EMPListData> data = backendOpenCardTaskService.empList(id, account);
        return new ResponseResult<ArrayList<EMPListData>>(SUCCESS,data);
    }

    @RequestMapping("setTask")
    public ResponseResult<Void> setTask(String[] ids, String value, String time, String account) {
        backendOpenCardTaskService.setTask(ids,value,time,account);
        return new ResponseResult<>(SUCCESS);
    }

}
